<style>
    div#view-content h3{
        clear: both;
    }
    div#view-content br{
        clear: both;
    }
    div#view-content span{
        float: left;
        padding: 3px;
        margin: 0px 2px 2px 0px;
        width: 400px;
    }
    div#view-content span.labels{
        clear: left;
        width: 90px;
        background-color: black;
        color: white;
        font-weight: bold;
    }
    
    .abutton{
        text-decoration: none;
        border: 1px #D3D3D3 outset;
        background-color: #e0f5e4;
        line-height: 1.6em;
        padding: 5px 8px;
    }
    .abutton:hover{
        background-color: #ccccff;
    }
    .abutton:visited{
        color: black;
    }
    .abutton:active{
        background-color: black;
        color: white;
    }
    .abutton img{
        border: 0px;
        margin-bottom: -3px;
        padding-right: 3px;
    }
</style>
<script type="text/javascript" src="<?=$this->baseUrl()?>/js/jquery.cookie.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        // get previous page then delete it
        var c = $.cookie('prevpage');
        $.cookie('prevpage',null);

        // assign the value as page when clicking back hyperlink
        if(c!=null){
            $("a#back").click(function(){
                window.location = "<?=$this->baseUrl()?>/shop/" + c;
            });

            // hide edit hyperlink if the previous page is not 'list' (list of active shop)
            if(c!='list') $("a#edit").hide();
        }

        // if the value is null, redirect to index page when clicking back hyperlink
        else{
            $("a#back").click(function(){
                window.location = "<?=$this->baseUrl()?>/shop/index";
            });
        }
    });
</script>
<?php $cycle = $this->cycle(array("#99ff99", "#ccffcc")); ?>
<div id="view-content">
    <span class="labels">Nama pemilik</span>
    <span style="background-color: <?=$cycle->next()?>;"><?php echo $this->shop["owner"]; ?></span>
    <span class="labels">Alamat</span>
    <span style="background-color: <?=$cycle->next()?>;"><?php echo $this->shop["address"]; ?></span>
    <span class="labels">Kota</span>
    <span style="background-color: <?=$cycle->next()?>;"><?php echo $this->shop["city"]; ?></span>
    <span class="labels">Nomor telp</span>
    <span style="background-color: <?=$cycle->next()?>;"><?php echo $this->shop["phone"]; ?></span>
    <span class="labels">Email</span>
    <span style="background-color: <?=$cycle->next()?>;"><?php echo $this->shop["email"]; ?></span>
    <span class="labels">Website</span>
    <span style="background-color: <?=$cycle->next()?>;"><a href="<?=$this->shop["url"]?>"><?php echo $this->shop["url"]; ?></a></span>
    <span class="labels">Tentang toko</span>
    <span style="background-color: <?=$cycle->next()?>;"><?php echo $this->shop["description"]; ?></span>
    <span class="labels">Menjual</span>
    <span style="background-color: <?=$cycle->next()?>;"><?php echo $this->shop["item_sold"]; ?></span>
    <span class="labels">Kategori</span>
    <span style="background-color: <?=$cycle->next()?>;">
        <?php
        $count = 0;
        foreach ($this->categories as $val):
            if ($count > 0)
                echo ", ";
            echo $val->cat_name;
            $count++;
        endforeach;
        ?>
    </span>
    <span class="labels">Keyword</span>
    <span style="background-color: <?=$cycle->next()?>;">
        <?php
        $count = 0;
        foreach ($this->keywords as $val):
            if ($count > 0)
                echo ", ";
            echo $val->name;
            $count++;
        endforeach;
        ?>&nbsp;
    </span>
    <span class="labels">Keanggotaan</span>
    <span style="background-color: <?=$cycle->next()?>;"><?php echo $this->shop["ms_name"]; ?></span>
    <span class="labels">Pengunjung</span>
    <span style="background-color: <?=$cycle->next()?>;"><?php echo $this->shop["hit"]; ?></span>
    <span class="labels">Rating</span>
    <span style="background-color: <?=$cycle->next()?>;"><?php echo $this->shop["rating"]; ?></span>
    <br><br>
    <a class="abutton" id="back" href="#" style="margin-right: 5px;">
        <img src="<?=$this->baseUrl()."/images/icons/arrow_left.png"?>" />Back
    </a>
    <a class="abutton" id="edit" href="<?=$this->url(array("controller"=>"shop","action"=>"edit","id"=>$this->shop["shop_id"]))?>">
        <img src="<?=$this->baseUrl()."/images/icons/pencil.png"?>" />Ubah
    </a>
</div>